package com.wyw.design.model.learning.behavioral.visitor.simple;

import java.util.List;

/**
 * @Title   对象结构
 * @Description
 * @Author Mr Wu yewen.wu.china@gmail.com
 * @Date 2023/4/19 17:11
 * Update History:
 * Author        Time            Content
 */
public class ObjectStructure {
    private List<ElementSimple> elementSimples;
    public ObjectStructure(List<ElementSimple> elementSimples) {
        this.elementSimples = elementSimples;
    }
    // 自定义方法，该方法往往要对 elements 进行遍历
    public void show(VisitorSimple visitorSimple) {
        for(ElementSimple elementSimple : elementSimples) {
            elementSimple.accept(visitorSimple);
        }
    }
}
